{include file="public/layout" /}
<body class="bodystyle">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    {include file="seo/bar" /}
    <form method="get" id="handlepost" name="form1">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>整站页面</label>
                </dt>
                <dd class="opt">       
                    <a href="javascript:void(0);" id="up_site" class="ncap-btn ncap-btn-green">一键生成</a>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>首页</label>
                </dt>
                <dd class="opt">       
                    <a href="javascript:void(0);" id="up_index" class="ncap-btn ncap-btn-green">一键生成</a>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">栏目页</dt>
                <dd class="opt">
                    <select name="html_typeid" id="html_typeid">
                        <option value="0">所有栏目…</option>
                        {$select_html}
                    </select>
                    &nbsp;<a href="javascript:void(0);" id="up_channel" class="ncap-btn ncap-btn-green">一键生成</a>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">文档页</dt>
                <dd class="opt">
                    <select name="html_arc_typeid" id="html_arc_typeid">
                        <option value="0">所有文档…</option>
                        {$arc_select_html}
                    </select>
                    &nbsp;<a href="javascript:void(0);" id="up_article" class="ncap-btn ncap-btn-green">一键生成</a>
                    <p class="notic"></p>
                </dd>
            </dl>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        
        //生成首页
        $("#up_index").click(function(){
            // $(".listbox").html('');
            var timestamp1 = Date.parse(new Date());
            $.ajax({
                url:__root_dir__+"/index.php?m=home&c=Buildhtml&a=buildIndex&_ajax=1",
                type:'GET',
                dataType:'json',
                data: {},
                beforeSend:function(){
                    layer_loading('正在处理');
                    // var index = layer.load(0, {shade: false}); 
                },
                success:function(data){
                    if(data.msg !== ""){
                        layer.alert(data.msg, {icon: 5, title:false,closeBtn: 0 },function () {
                            layer.closeAll();
                        } );
//                        layer.closeAll();
                    }else{
                        // $(".listbox").prepend(data.msg);
                        layer.closeAll();
                        var timestamp2 = Date.parse(new Date());
                        var timestamp3 = (timestamp2 - timestamp1) / 1000;
                        if (timestamp3 < 1) timestamp3 = 1; 
                        layer.msg("生成完毕，共耗时：<font color='red'>"+timestamp3+"</font> 秒",{icon:1,time:2000}); 
                    }
                },
                complete:function(){
                    // layer.alert(1, {icon: 5, title:false});
                }
            });
        })
        
        //生成栏目页
        $("#up_channel").click(function(){
            var typeid = $("#html_typeid").val();     //栏目id
            var url = eyou_basefile+"?m=admin&c=Seo&a=channel&action=buildChannel&id="+typeid+"&lang="+__lang__;
            var index = layer.open({type: 2,title: '开始生成',area: ['500px', '300px'],fix: false, maxmin: false,content: url});
        })

        //生成文章页
        $("#up_article").click(function(){
            var typeid = $("#html_arc_typeid").val();     //栏目id
            var url = eyou_basefile+"?m=admin&c=Seo&a=channel&action=buildArticle&id="+typeid+"&lang="+__lang__;
            var index = layer.open({type: 2,title: '开始生成',area: ['500px', '300px'],fix: false, maxmin: false,content: url});
        })

        //生成整站
        $("#up_site").click(function(){
            var url = eyou_basefile+"?m=admin&c=Seo&a=site&lang="+__lang__;
            var index = layer.open({type: 2,title: '开始生成',area: ['500px', '300px'],fix: false, maxmin: false,content: url});
        })
    })
</script>
{include file="public/footer" /}